A large number of applications today are multi-threaded. Multi-threading allows the execution of a particular application or program to be divided into two or more separate threads. Each of these threads may then be executed in parallel on a multi-processor, or multi-core system. However, the use of multi-threading in multi-processor or multi-core settings increases the possibility and probability of concurrency errors, such as race conditions.
In a multithreaded program, a data race condition occurs when a shared memory location is accessed by two or more concurrent threads, with at least one of the accesses being a write, without proper synchronization to constrain the ordering of the accesses. The effects of the execution in such a case depend on the particular order in which the accesses take place. Race conditions often result in unexpected and undesirable program behavior, such as program crashes or incorrect results.
Some data race detection solutions monitor lock acquisition, synchronization operations, and memory accesses, computing an access pattern for each memory location and memory access. These solutions then analyze the access to memory location patterns to detect suspicious access patterns that may indicate a potential data race. An access pattern may be considered to be “suspicious” if a memory location is shared among multiple threads without a common lock that may be used by individual threads/programs to govern access to the memory locations.